using DG.Tweening;
using UnityEngine;

public class Common
{
    public static float CameraFollowSpeed { get; set; } = 5.0f;

    public static void CameraFollow(Vector3 target)
    {
        var x = Mathf.Clamp(target.x, 0, 25);
        Camera.main.transform.DOMoveX(x, 1.0f);
    }

    public static void ResetCamera()
    {
        Common.CameraFollow(new Vector3(0, 0, 0));
    }

    public static void ClearChildren(Transform transform)
    {
        var transforms = transform.GetComponentsInChildren<Transform>();
        foreach (var t in transforms)
        {
            if (t == transform)
            {
                continue;
            }
            GameObject.Destroy(t.gameObject);
            Debug.Log("ClearChildren");
        }
    }
}